fix: sound plugin display incorrect volume tips#315
Conversation
Reviewer's GuideThis PR refactors SoundView so that volume is no longer passed around but retrieved internally when updating the UI, ensuring the displayed volume tip reflects the current mute and volume state correctly. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey @yixinshark - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| m_tipsLabel->setText(QString(tr("Mute"))); | ||
| } else { | ||
| auto volume = std::min(150, SoundModel::ref().volume()); | ||
| m_tipsLabel->setText(QString(tr("Volume %1").arg(QString::number(volume) + '%'))); |
There was a problem hiding this comment.
suggestion: Include the percent sign in the translatable string and simplify arg usage
Use tr("Volume %1% ").arg(volume) to include '%' in the translatable string and remove manual concatenation and extra QString wrappers.
| m_tipsLabel->setText(QString(tr("Volume %1").arg(QString::number(volume) + '%'))); | |
| m_tipsLabel->setText(tr("Volume %1%").arg(volume)); |
| if (SoundModel::ref().isMute()) { | ||
| m_tipsLabel->setText(QString(tr("Mute"))); | ||
| } else { | ||
| auto volume = std::min(150, SoundModel::ref().volume()); |
There was a problem hiding this comment.
suggestion: Avoid magic number for max volume clamp
Define a named constant (e.g. MAX_VOLUME) or move the clamp into SoundModel so the view doesn’t use a hard-coded limit.
mute status changed, then update volume tips, false status revert to zero, so tips show 0 value Log: as title Pms: BUG-313463
deepin pr auto review代码审查意见:
以上是针对代码审查的几点意见,希望能对您有所帮助。 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, yixinshark The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
mute status changed, then update volume tips, false status revert to zero, so tips show 0 value
Log: as title
Pms: BUG-313463
Summary by Sourcery
Simplify the SoundView refresh logic by removing explicit volume arguments and always fetching the latest volume inside refreshTips, resolving wrong volume displays after mute toggles.
Bug Fixes:
Enhancements: